<!doctype html>
<html lang="zh" xmlns:th="https://www.thymeleaf.org">
<head>
    <th:block th:include="include-front-custom :: head('5180it.com','欢迎进入')"/>

	<style type="text/css">
		.paBanner{ position:fixed;}
		.prevBanner,.nextBanner{ cursor:pointer; width:8%; height:100%; _height:100%; top:0;}
		.prevBanner{ left:0; background:url(/img/arrow_l.png) no-repeat center 44%;}
		.prevBanner:hover{background:#efefef url(/img/arrow_l.png) no-repeat center 44%;}
		.nextBanner{ right:0;background:url(/img/arrow_r.png) no-repeat center 44%;}
		.nextBanner:hover{background:#efefef url(/img/arrow_r.png) no-repeat center 44%;}
	</style>

    <!-- 遮罩层 -->
    <script th:src="@{/ajax/libs/blockUI/jquery.blockUI.js}"></script>

    <script th:src="@{/ajax/libs/layer/layer.min.js}"></script>
   <!-- <script th:src="@{/ajax/libs/layui/layui.js}"></script>-->
    <script th:src="@{/dimple/js/common.js}"></script>
    <script th:src="@{/dimple/js/ui.js}"></script>
</head>

<body class="nobg">
<!--<th:block th:replace="include-front-custom :: header"/>-->
<header class="myheader" th:fragment="header">
    <!--导航开始-->
    <div class="top">
        <div class="top-left">
            <!--logo部分-->
            <div class="logo">
                <a href="/">
                    <img src="/front/images/logo.png"/>
                </a>
            </div>
            <!--滚动消息-->
            <div class="web-xiaoxi">
                <i class="fa fa-volume-up"></i>
                <ul class="mulitline">
                    <li th:each="notice:${notices}" th:text="${notice.noticeTitle}"></li>
                </ul>
            </div>
            <!--手机菜单按钮-->
            <div class="mobile-nav"><i class="fa fa-list"></i><i class="fa fa-remove"></i></div>
        </div>
        <!--电脑导航开始-->
        <nav class="mynav">
            <ul class="orange-text">
                <li th:each="func:${funcList}">
                    <a th:href="${func.url}"
                       th:text="${func.funcName}"></a>
                </li>
                <li class='drop'  th:if="${curUser!=null}">
                    <a href="JavaScript:;">我的 <i class='fa fa-chevron-down '></i></a>
                    <div class="drop-nav orange-text ">
                        <ul>
                           <!--  <li>
	                             <a href="#" th:text="${curUser.loginName}">当前用户</a>
	                        </li> -->
	                        <li>
	                             <a href="/frontLogout?toPage=kaoshi">退出登录</a>
	                        </li>
                        </ul>
                    </div>
                </li>
                <li th:if="${curUser==null}">
                	<a href="/bbs/front/toLogin?toPage=kaoshi">
		                <img class="img-circle"
		                     src="/front/images/default_head_img.gif"
		                     alt="登录" title="登录" style="margin-top: 12px;">
		          	 </a>
                </li>
            </ul>

            <!--移动的滑动-->
            <div class="move-bg"></div>
            <!--移动的滑动 end-->
        </nav>

        <!--手机导航-->
        <div class="mob-menu">
            <!--手机下拉菜单-->
            <ul class="mob-ulnav">
                 <li th:each="func:${funcList}">
                    <a th:href="${func.url}"
                       th:text="${func.funcName}"></a>
                </li>
                <li class='mob-drop'  th:if="${curUser!=null}">
                    <a href="javascrip:;">我的<i></i></a>
                    <ul class="mob-dropmenu">
                     	<!-- <li>
                             <a href="#" th:text="${curUser.loginName}">当前用户</a>
                        </li> -->
                        <li>
                             <a href="/frontLogout?toPage=kaoshi">退出登录</a>
                        </li>
                    </ul>
                </li>
                <li th:if="${curUser==null}">
                	<a href="/bbs/front/toLogin?toPage=kaoshi">
		                <img class="img-circle"
		                     src="/front/images/default_head_img.gif"
		                     alt="登录" title="登录" style="margin-top: 12px;">
		          	 </a>
                </li>
            </ul>
        </div>
    </div>
    <!--导航结束-->
</header>

<!--内容区开始-->
<div class="container">
    <!--最新文章-->
    <section class="mysection" style="width: 95%;">
        <!-- <h4 class="index-title">
            <a href="/"><i class="fa fa-home"></i>当前页: &nbsp;> </a>
            <span class="orange-text" th:text="${funcName}"></span>
            <span style="float:right;margin-right:10px;">共有文章:<font class="orange-text"
                th:text="${blogs.total}"> 11 </font>篇</span>
        </h4> -->
        <!--<div>
            <p class="smallText" th:text="${'分类描述：'+funcName}"></p>
            <p class="smallText" th:text="${'创建时间：'+funcName}"></p>
        </div>-->
        
        <h4 class="index-title">
        	<a href="javascript:void(0);"><i class="fa fa-home"></i>当前页: &nbsp;错题集 </a>
            <a th:if="${curUser!=null}" class="orange-text" th:href="${'/kaoshi/questionFolder/'+funcId+'/'+folderId+'.html'}">&lt;&lt;【返回】</a>
        </h4>
        <hr/>
        <!--分页开始-->
        <div th:replace="navigation :: navigation-direct(${questionList})"></div>
        <!--分页结束-->
        <div class="arclist">
            <!--列表开始-->
                <div th:each="question:${questionList.list}">
                    <div class="arc-left">
                        <h4 class="blue-text">
                        	 [[${question.questionOrder}]]
                            <a th:text="${question.content}"></a>
                        </h4>
                            <span style="display: block;" th:each="qo:${question.optionList}" 
                            	th:text="${qo.optionOrder+'、'+qo.optionVal}"></span>
                            	
                        <p style="margin-top: 10px;">
                       		<span style="color: #67c23a;" th:text="${'正確答案： '+question.answer}"></span>
                       		
                       	 <span th:if="${curUser!=null}" class="orange-text">
                       	 	<a th:style="'display:' + @{(${question.hasFavorites} eq 0 ? 'none' : 'inline-block')} + ';float: right;'" 
                       	 		th:onclick="delFavorites([[${question.id}]]);"  th:id = "delQues+(${question.id})"><i class="fa fa-star"></i>已收藏</a>
                       	 		
                        	<a th:style="'display:' + @{(${question.hasFavorites ne 0} ? 'none' : 'inline-block')} + ';float: right;'"
                        		 th:onclick="addFavorites([[${question.id}]]);"  th:id = "addQues+(${question.id})"><i class="fa fa-star-o"></i>未收藏</a>
                       	 </span>	
                        </p>
                    </div>
                </div>
            <!--列表结束-->
        </div>
        <!--分页开始-->
        <div th:replace="navigation :: navigation-direct(${questionList})"></div>
        <!--分页结束-->
    </section>
    
    <a href="javascript:void(0);" class="prevBanner paBanner none" id="banner_prev"></a>
    <a href="javascript:void(0);" class="nextBanner paBanner" id="banner_next"></a>
    
    <!--左侧结束-->
    <!--<th:block th:replace="include-front-custom :: side"/>-->
</div>
<!--<th:block th:replace="include-front-custom :: footer"/>-->

<script>
	$(function(){
		$('#banner_next').bind('click',function(){
			$('.paginationNext')[0].click();
		});
		$('#banner_prev').click(function(){
			$('.paginationPrev')[0].click();
		});
		
		/* $(".optionRationCls").click(function(){
			var checkValue = $(this).val(); 
			console.info("click"+checkValue);
		}); */
		$(".optionRationCls").change(function(){
			var checkValue = $(this).val(); 
			$.ajax({
	           type: "POST",
	           url: "/kaoshi/addAnswer",
	           data: {"questionOptionId": checkValue},
	           dataType: "json",
	           success: function (data) {
	        	   console.info(data);
	        	   $("#yourAnswer"+checkValue.split("_")[0]).closest(".questionAnswerSpanCls").show();
	        	   if(data.correct==1){//正确
	        		   $("#yourAnswer"+checkValue.split("_")[0]).html("<span style='color: #67c23a;'>&nbsp;&nbsp;&nbsp;&nbsp;您的答案："+ data.youAnswer +"</span>");
	        	   }else{
	        		   $("#yourAnswer"+checkValue.split("_")[0]).html("<span style='color: red;'>&nbsp;&nbsp;&nbsp;您的答案："+ data.youAnswer +"</span>");
	        	   }
	        	   if (data.code == 200) {
	                   //刷新当前评论框 不做弹框提示
	                   //layer.msg(data.msg, {icon: 1});
	               } else {
	                   layer.msg(data.msg, {icon: 2});
	               }
	           },
	           error: function (jqXHR) {
	        	   layer.msg('发送错误：' + jqXHR.status);
	           },
	       });
		});
	});
	//收藏
   function addFavorites(questionId){
	   $.ajax({
           type: "POST",
           url: "/kaoshi/addFavorites",
           data: {"questionId": questionId},
           dataType: "json",
           success: function (data) {
        	   console.info(data);
        	   if(data.hasFavorites==1){//已收藏的
        		   $("#addQues"+questionId).hide();
        		   $("#delQues"+questionId).show();
        	   }else{
        		   $("#addQues"+questionId).show();
        		   $("#delQues"+questionId).hide();
        	   }
        	   if (data.code == 200) {
                   //刷新当前评论框
                   layer.msg(data.msg, {icon: 1});
               } else {
                   layer.msg(data.msg, {icon: 2});
               }
           },
           error: function (jqXHR) {
        	   layer.msg('发送错误：' + jqXHR.status);
           },
       });
   }
	
   function delFavorites(questionId){
	   $.ajax({
           type: "POST",
           url: "/kaoshi/delFavorites",
           data: {"questionId": questionId},
           dataType: "json",
           success: function (data) {
        	   console.info(data);
        	   if(data.hasFavorites==1){//已收藏的
        		   $("#addQues"+questionId).hide();
        		   $("#delQues"+questionId).show();
        	   }else{
        		   $("#addQues"+questionId).show();
        		   $("#delQues"+questionId).hide();
        	   }
        	   if (data.code == 200) {
                   //刷新当前评论框
                   layer.msg(data.msg, {icon: 1});
               } else {
                   layer.msg(data.msg, {icon: 2});
               }
           },
           error: function (jqXHR) {
        	   layer.msg('发送错误：' + jqXHR.status);
           },
       });
   }
</script>
</body>
</html>